home *** CD-ROM | disk | FTP | other *** search
/ 1,000+ Great Games / 1_1000 Games.iso / GAMES_1 / CHESSCLK.ZIP / SOUND.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-14  |  1.8 KB  |  68 lines

  1. #include <dos.h>
  2.  
  3. /**********************************TONE***********************************/
  4. /*         Produces tone at frequency, duration (of sound)               */
  5. /*     Arguments in: freq [in Hz], dur [duration in millisec.]           */
  6. /*************************************************************************/
  7.  
  8. void tone( int freq, int dur )
  9. {
  10.         sound( freq );
  11.         delay( dur );
  12.         nosound();
  13.         return;
  14. }
  15.  
  16. /**************************************************************************/
  17. /*                 Produces a "two-tone" sound  (beep-boop)               */
  18. /**************************************************************************/
  19. void two_tone()
  20.  
  21. {
  22.     int frequency,
  23.          duration;
  24.  
  25.         frequency = 700;
  26.         duration  = 165;
  27.         tone( frequency, duration );
  28.  
  29.         frequency = 450;
  30.         duration = 110;
  31.         tone( frequency, duration );
  32.  
  33. }
  34.  
  35.  
  36.  
  37. /**************************************************************************/
  38. /*                                   BELL                                 */
  39. /*                   Produces a succession of 'beep' tones                */
  40. /*               Takes 'times' as argument [# of times to beep]           */
  41. /**************************************************************************/
  42.  
  43. void bell( int times )
  44.  
  45. {
  46.         while( times-- )
  47.             {
  48.             tone(380,165);
  49.             delay (20 );
  50.             }
  51.         return;
  52. }
  53.  
  54. /**************************************************************************/
  55. /*                                   BLATT                                */
  56. /*                         Produces a "Bronx Cheer"                       */
  57. /*                         [use with error routine]                       */
  58. /**************************************************************************/
  59.  
  60. void blatt()
  61.  
  62. {
  63.         tone( 42,330 ); 
  64.         tone(34,220);
  65.         return;  
  66. }
  67.  
  68.